# Contributor: Natanael Copa <ncopa@alpinelinux.org>
# Contributor: Michał Polański <michal@polanski.me>
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=sshguard
pkgver=2.4.3
pkgrel=1
pkgdesc="Protects hosts from brute-force attacks against SSH and other services"
url="https://www.sshguard.net/"
arch="all"
license="ISC"
depends="iptables"
makedepends="flex bison autoconf automake libtool"
subpackages="$pkgname-openrc $pkgname-doc"
source="https://downloads.sourceforge.net/project/sshguard/sshguard/$pkgver/sshguard-$pkgver.tar.gz
	sshguard.initd
	sshguard.confd
	"

build() {
	CFLAGS="$CFLAGS -flto=auto" \
	./configure \
		--build=$CBUILD \
		--host=$CHOST \
		--prefix=/usr \
		--sysconfdir=/etc
	make
}

check() {
	make check
}

package() {
	make DESTDIR="$pkgdir" install

	install -Dm755 "$srcdir"/sshguard.initd "$pkgdir"/etc/init.d/sshguard
	install -Dm644 "$srcdir"/sshguard.confd "$pkgdir"/etc/conf.d/sshguard
}

sha512sums="
eeecea1007c1a21a28835a6d29c2cbffc647b3ab09a3525600e91b978d4ebdda9e6a7e2884da26bb1d7f64de561ac8bd1788bb776730d37b7a4fa49b22885b4a  sshguard-2.4.3.tar.gz
3dfd291b74fd7082ade5e3339e5641e546fb98cf88be29cc9744e5cd316b128580a17c4d1d36f6b03eec73491645c670759ca6f82fe2555eff34adb090df69cb  sshguard.initd
be29acae12bc51019febc283bb1c4fff0cd0a475a330a0ca1b4196bbc88a9a70922b82b7d56250e04d6491a4670ebb36d39c65c28fa0f20093355bd7ad3e4d2f  sshguard.confd
"
